// 获取任务列表
export const listTask = (params) => {
    return $fetchList(`/cc/task/list`, {
      method: "GET",
      query: {
        ...params,
      },
    });
  };

// 获取当前租户接单任务列表
export const listTakenTask = (params) => {
    return $fetchList(`/cc/task/list/taken`, {
        method: "GET",
        query: {
        ...params,
        },
    });
};

// 获取当前租户发布任务列表
export const listPublishTask = (params) => {
    return $fetchList(`/cc/task/list/publish`, {
        method: "GET",
        query: {
        ...params,
        },
    });
};

// 获取任务详情
export const getTask = (taskId) => {
    return $api(`/cc/task/${taskId}`, {
        method: "GET",
    });
};



// 发布任务
export const publishTask = (params) => {
  return $api(`/cc/task`, {
    method: "POST",
    body: params,
  });
};

// 接单
export const takeTask = (taskId) => {
  return $api(`/cc/task/take/${taskId}`, {
    method: "PUT",
  });
};


// 撤单
export const cancelTask = (taskId) => {
  return $api(`/cc/task/cancel/${taskId}`, {
    method: "PUT",
  });
};

export const getTaskDelivery = (taskId) => {
  return $api(`/cc/task/delivery/${taskId}`, {
    method: "GET",
  });
};

export const addTaskDelivery = (params) => {
  return $api(`/cc/task/delivery`, {
    method: "POST",
    body: params,
  });
};

export const updateTaskDelivery = (params) => {
  return $api(`/cc/task/delivery`, {
    method: "PUT",
    body: params,
  });
};

export const checkTaskDelivery = (params) => {
  return $api(`/cc/task/delivery/check`, {
    method: "PUT",
    body: params,
  });
};



export const NORMAL_TASK_STATUS = {
  1: "待接单",
  3: "制作中",
  4: "已完成",
}

export const ALL_TASK_STATUS = {
  0: "待审核",
  1: "待接单",
  2: "审核失败",
  3: "制作中",
  4: "已完成",
}

export const TAKEN_TASK_STATUS = {
  3: "制作中",
  4: "已完成",
}

export const TASK_DELIVERY_STATUS = {
  0: {title: "待验收", color: "info"},
  1: {title: "验收成功", color: "success"},
  2: {title: "验收失败", color: "error"},
}